package com.nwpu.coursesupport.tool;

import java.util.Random;

public class RandomUtil {

	public static final Random random = new Random();
	
	public static String genClassCode(String num){
		StringBuilder sb=new StringBuilder();
		if(num.length()>4){
			String s=num.substring(num.length()-4,num.length());
			sb.append(s);
		}else if(num.length()<4){
			for(int i=0;i<4-num.length();i++){
				sb.append(random.nextInt(9));
			}
			sb.append(num);
		}else{
			sb.append(num);
		}
		sb.append(random.nextInt(9));
		sb.append(random.nextInt(9));
		return sb.toString();
	}

}
